home *** CD-ROM | disk | FTP | other *** search
/ IRIX Development Foundation 1.1 for IRIX 6.2 / SGI IRIX 6.2 Development Foundation 1.1.iso / dist / patchSG0001645.idb / usr / include / time.h.z / time.h
C/C++ Source or Header  |  1997-07-01  |  5KB  |  199 lines

  1. #ifndef __TIME_H__
  2. #define __TIME_H__
  3. #ifdef __cplusplus
  4. extern "C" {
  5. #endif
  6. #ident "$Revision: 1.44 $"
  7.  
  8. /*
  9. *
  10. * Copyright 1992-1996 Silicon Graphics, Inc.
  11. * All Rights Reserved.
  12. *
  13. * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.;
  14. * the contents of this file may not be disclosed to third parties, copied or
  15. * duplicated in any form, in whole or in part, without the prior written
  16. * permission of Silicon Graphics, Inc.
  17. *
  18. * RESTRICTED RIGHTS LEGEND:
  19. * Use, duplication or disclosure by the Government is subject to restrictions
  20. * as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data
  21. * and Computer Software clause at DFARS 252.227-7013, and/or in similar or
  22. * successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -
  23. * rights reserved under the Copyright Laws of the United States.
  24. */
  25. /*    Copyright (c) 1988 AT&T    */
  26. /*      All Rights Reserved      */
  27.  
  28. /*    THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T    */
  29. /*    The copyright notice above does not evidence any       */
  30. /*    actual or intended publication of such source code.    */
  31.  
  32. /*
  33.  * WARNING - this is an ANSI/POSIX/XPG4 header. Watch for name space pollution
  34.  */
  35. #include <standards.h>
  36. #include <sys/types.h>
  37. #include <sys/signal.h>
  38.         
  39. #ifndef NULL
  40. #define NULL    0L
  41. #endif
  42.  
  43. #if !defined(_SIZE_T) && !defined(_SIZE_T_)
  44. #define _SIZE_T
  45. #if (_MIPS_SZLONG == 32)
  46. typedef unsigned int    size_t;
  47. #endif
  48. #if (_MIPS_SZLONG == 64)
  49. typedef unsigned long    size_t;
  50. #endif
  51. #endif 
  52.  
  53. #ifndef _CLOCK_T
  54. #define _CLOCK_T
  55. #if (_MIPS_SZLONG == 32)
  56. typedef long     clock_t;
  57. #endif
  58. #if (_MIPS_SZLONG == 64)
  59. typedef int     clock_t;
  60. #endif
  61. #endif 
  62.  
  63. #ifndef _TIME_T
  64. #define _TIME_T
  65. #if (_MIPS_SZLONG == 32)
  66. typedef long     time_t;
  67. #endif
  68. #if (_MIPS_SZLONG == 64)
  69. typedef int     time_t;
  70. #endif
  71. #endif /* !_TIME_T */
  72.  
  73. #if ((_POSIX93 && _NO_ANSIMODE) || _ABIAPI)
  74.  
  75. #if !defined(_STANDALONE)
  76. #include <sys/ptimers.h>
  77. #endif
  78. #endif /* (_POSIX93 && _NO_ANSIMODE) || _ABIAPI */
  79.     
  80. #ifndef _CLOCK_ID_T
  81. #define _CLOCK_ID_T
  82. typedef int             clockid_t;
  83. #endif
  84. #ifndef _TIMER_T
  85. #define  _TIMER_T
  86. typedef int        timer_t;
  87. #endif
  88.  
  89. #if _SGIAPI
  90. #ifndef timespec_to_timeval
  91. #define timespec_to_timeval(t, ts) \
  92.         (t)->tv_sec = (ts)->tv_sec; \
  93.         (t)->tv_usec = (ts)->tv_nsec / 1000;
  94.  
  95. #define timeval_to_timespec(ts, t) \
  96.         (ts)->tv_sec = (t)->tv_sec; \
  97.         (ts)->tv_nsec = (t)->tv_usec * 1000;
  98.  
  99. #endif
  100. #ifndef NSEC_PER_SEC
  101. #define NSEC_PER_SEC    1000000000L
  102. #endif
  103. #endif /* SGIAPI */
  104.  
  105. #define CLOCKS_PER_SEC        1000000
  106.  
  107. struct    tm {    /* see ctime(3) */
  108.     int    tm_sec;
  109.     int    tm_min;
  110.     int    tm_hour;
  111.     int    tm_mday;
  112.     int    tm_mon;
  113.     int    tm_year;
  114.     int    tm_wday;
  115.     int    tm_yday;
  116.     int    tm_isdst;
  117. };
  118.  
  119. /*
  120.  * Std ANSI functions
  121.  */
  122. extern clock_t clock(void);            
  123. extern double difftime(time_t, time_t);        
  124. extern time_t mktime(struct tm *);        
  125. extern time_t time(time_t *);            
  126. extern char *asctime(const struct tm *);        
  127. extern char *ctime (const time_t *);        
  128. extern struct tm *gmtime(const time_t *);        
  129. extern struct tm *localtime(const time_t *);    
  130. extern size_t strftime(char *, size_t, const char *, const struct tm *);
  131.  
  132. #if _POSIX90 && _NO_ANSIMODE
  133. /*
  134.  * POSIX1003.1 additions
  135.  */
  136. extern void tzset(void);
  137. extern char *tzname[2];
  138.  
  139. #ifndef CLK_TCK
  140. #define CLK_TCK    sysconf(3)    /* clock ticks per second */
  141.                 /* 3 is _SC_CLK_TCK */
  142. #endif /* CLK_TCK */
  143. #endif /*  _POSIX90 */
  144.  
  145. #if _POSIX93 && _NO_ANSIMODE && !defined(_STANDALONE)
  146. /*
  147.  * POSIX 1003.1b-1993 clock and timer functions
  148.  */
  149. struct sigevent;
  150. extern int clock_settime(clockid_t, const struct timespec *);
  151. extern int clock_gettime(clockid_t, struct timespec *);
  152. extern int clock_getres(clockid_t, struct timespec *);
  153. extern int nanosleep(const struct timespec *, struct timespec *);
  154. extern int timer_create(clockid_t, struct sigevent *, timer_t *);
  155. extern int timer_delete(timer_t);
  156. extern int timer_settime(timer_t, int, const struct itimerspec *, struct itimerspec *);
  157. extern int timer_gettime(timer_t, struct itimerspec *);
  158. extern int timer_getoverrun(timer_t);
  159. #endif /* _POSIX93 */
  160.  
  161. #if _XOPEN4 && _NO_ANSIMODE
  162. /*
  163.  * XPG4 additions
  164.  */
  165. extern time_t timezone;
  166. extern int daylight;
  167. extern char *strptime(const char *, const char *, struct tm *);
  168. #endif
  169.  
  170. #if _XOPEN4UX && _NO_ANSIMODE
  171. /*
  172.  * XPG4-UX additions
  173.  */
  174. extern struct tm *getdate(const char *);
  175. extern int getdate_err;
  176. #endif    /* _XOPEN4UX */
  177.  
  178. #if _SGIAPI
  179. extern int cftime(char *, char *, const time_t *);
  180. extern int ascftime(char *, const char *, const struct tm *);
  181. extern time_t altzone;
  182. #endif    /* _SGIAPI */
  183.  
  184. #if _POSIX1C && _NO_ANSIMODE
  185. /*
  186.  * POSIX1c additions
  187.  */
  188. extern char *asctime_r(const struct tm *, char *);
  189. extern char *ctime_r(const time_t *, char *);
  190. extern struct tm *gmtime_r(const time_t *, struct tm *);
  191. extern struct tm *localtime_r(const time_t *, struct tm *);
  192. #endif /* _POSIX1C */
  193.  
  194. #ifdef __cplusplus
  195. }
  196. #endif
  197. #endif /* !__TIME_H__ */
  198.  
  199.